/**
 *@brief	�û���һЩ��ݽṹ���Լ���ɺ�ɾ����������뷽�� 
 *@date		2015-12-14
 *@author	ikangtai-wangwei
 *@copyright iknagtai corp
 **/
#include"al.h"
#include"common.h"
#include<android/log.h>
#ifndef SPECIALCONDITION_HEAD

#define SPECIALCONDITION_HEAD

//#define TEST_SPE
/*�˱�����Ҫ�������жϵ�һ��ʹ��ʱ��cycleӦ�ó�����ʼλ��*/
#define FIRSTUSE_START_CYCLE_INDEX     3 
/**
 *@brief	���û���дע����Ϣ֮���㷨����Ľ��    
 *@param	time_t tinput �û���д�����һ�ξ��ڿ�ʼ 
 *@param	int periodLength �û���д�ľ��ڳ��� 
 *@param	int cycleLength
 *@param	int mensLengthError
 *@param	int cycleLengthError
 *@param	cycleUnitDS* cycleOutput �㷨��������ڽ�� 
 *@param	int* cycleOutputLength ��������ڽ��ĳ��� 
 *@param	dayUnitDSOutput* daysData �㷨�����ÿ������ 
 *@param	int* daysDataLength �㷨�����ÿ�����ݵĳ��� 
 *@param	userUnitDS* userData �㷨������û�ͳ����ݽ�� 
 *@return   bool true:�㷨��ִ�й���У�û�������쳣��false���㷨��ִ�й���У������쳣û����ȷִ�н��� 
 *@note     
 **/ 
int theFirstUse(time_t tinput, int periodLength, int cycleLength,int mensLengthError, int cycleLengthError,
				cycleUnitDS *cycleOutput,int *cycleOutputLength,dayUnitDSOutput *daysData,int *daysDataLength,userUnitDS *userData);

/**
 *@brief	ͨ���ڿ�ʼ�������������3��ָ�����õ�һ�����ڵ����    
 *@param	time_t ps ���ڿ�ʼ  
 *@param	time_t pe ���ڽ��� 
 *@param	time_t ov ������ 
 *@param	cycleUnitDS *cycleOutput �㷨��������ڽ��
 *@param	int flagBit ��־λ�����ps��pe��ov����� 
 *@param	int peLength  ���ڵĳ��� 
 *@param	int cycleLength ���ڵĳ��� 
 *@return   bool true:�㷨��ִ�й���У�û�������쳣��false���㷨��ִ�й���У������쳣û����ȷִ�н��� 
 *@note     
 **/
bool inputPSPEAndOV(time_t ps,time_t pe,time_t ov,cycleUnitDS *cycleOutput,int flagBit,int peLength,int cycleLength,int cycleNum);

/**
 *@brief	�����ڸմ����ǵ�һ��APPת�Ƶ��ڶ���APP���û������ǵ������Ҫȫ�����¼���    
 *@param	int length ������ݵĳ��� 
 *@param	dayUnitDSInput *daysInput �����ÿ����� 
 *@param	dayUnitDSOutput *daysOutput �����ÿ����� 
 *@param	cycleUnitDS *cycleOutput �㷨��������ڽ��
 *@param	userUnitDS *userData  �㷨�����ͳ�ƽ���� 
 *@return   bool true:�㷨��ִ�й���У�û�������쳣��false���㷨��ִ�й���У������쳣û����ȷִ�н��� 
 *@note     
 **/
int transV1TOV2DS(int length,dayUnitDSInput *daysInput,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength);
					
int transV1TOV2DS_V2(int length,dayUnitDSInput *daysInput,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength);

int transV2TOV2DS(int length,dayUnitDSInput *daysInput,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength);
int transV1TOV2DS_V2_Filer(int length,dayUnitDSInput *daysInput,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength);
int changePastInfo_deletePeriod(int dayInputlength,dayUnitDSInput *daysInput,cycleUnitDS *cycleInput,int cycleInputLength,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength);
int changePastInfo_inputPeriod(int dayInputlength,dayUnitDSInput *daysInput,cycleUnitDS *cycleInput,int cycleInputLength,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength,int shouldRecoveryCycle);
int changePastInfo_inputRecord(int dayInputlength,dayUnitDSInput *daysInput,cycleUnitDS *cycleInput,int cycleInputLength,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength);
int changePastInfo_inputBBT(int dayInputlength,dayUnitDSInput *daysInput,cycleUnitDS *cycleInput,int cycleInputLength,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength);
int fixOldPE(time_t peRight,time_t peWrong,cycleUnitDS *cycleInput,cycleUnitDS *cycleOutput,int *cycleOutputLength,
				userUnitDS *userData,dayUnitDSOutput *daysData,int *daysDataLength);	
int throughPSPEAndNextPSGetCycle(time_t ps,time_t pe,int peReal,cycleUnitDS *nextCycleInput,userUnitDS *userdata,cycleUnitDS *cycleInput);	
int changePastInfo_inputPeriod_filer(int dayInputlength,dayUnitDSInput *daysInput,cycleUnitDS *cycleInput,int cycleInputLength,dayUnitDSOutput *daysOutput,
					cycleUnitDS *cycleOutput,userUnitDS *userData,int *dayOutLength,int *cycleOutLength);							
#endif
